from  machine import  Pin
import utime
# 数码管显示驱动
import tm1637

# 数码管显示
def seg_show(seg):
    # 亮度调节0-7
    seg.brightness(1)
    
    # 显示小数03.14
    seg.numbers(3,14)
    utime.sleep(1)
    
    
    # 显示字符串
    seg.show("POLO")
    utime.sleep(1)
    
    # 显示十六进制数0064
    seg.hex(100)
    utime.sleep(1)
    
    # 滚动显示字符串
    seg.scroll("1314-520", 200)
    utime.sleep(1)
    
    # 温度数值显示25℃
    seg.temperature(25)
    utime.sleep(1)
    

if __name__ == "__main__":
    # 创建数码管对象
    # clk: 时钟引脚
    # dio: 数据引脚
    seg = tm1637.TM1637(clk=Pin(14), dio=Pin(27))
    # 亮度调节0-7
    seg.brightness(5)
    
    while True:
        # seg_show(seg)
        # 滚动显示字符串
        seg.scroll("ABCDEFG", 200)
    
    
    